package com.ucode.model.hrm.enums;

import com.ucode.tool.base.IntArrayValuable;

import java.util.Arrays;

/**
 * 打卡状态枚举类
 */
public enum HrmAttendanceRecordsStatusEnum implements IntArrayValuable {

    NORMAL(1, "正常"),
    LATE(2, "迟到"),
    EARLY_LEAVE(3, "早退"),
    IN_ABSENT(4, "上班缺勤"),
    OUT_ABSENT(5, "下班缺勤"),
    ABSENT(6, "全天缺卡"),
    LATE_AND_EARLY_LEAVE(7, "迟到且早退"),
    OUT_OF_RANGE(8, "超出打卡范围");

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(HrmAttendanceRecordsStatusEnum::getCode).toArray();

    private Integer code;
    private String message;

    HrmAttendanceRecordsStatusEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static HrmAttendanceRecordsStatusEnum get(Integer code) {
        for (HrmAttendanceRecordsStatusEnum status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }



    public int[] array() {
        return ARRAYS;
    }
}